import 'package:flutter/material.dart';
import 'dart:io';
import 'package:flutter_ytx_plugin/src/flutter_ytx_plugin.dart';

extension FontWeightExt on FontWeight {
  static const FontWeight light = FontWeight.w300;
  static const FontWeight regular = FontWeight.w400;
  static FontWeight medium =
      Platform.isAndroid ? FontWeight.w600 : FontWeight.w600;
  static const FontWeight semiBold = FontWeight.w600;
  static const FontWeight bold = FontWeight.w700;
}

extension FUiExt on Widget {
  static double get F10 => 10.0;

  static double get F11 => 11.0;

  static double get F12 => 12.0;

  static double get F12_5 => 12.5;

  static double get F13 => 13.0;

  static double get F14 => 14.0;

  static double get F15 => 15.0;

  static double get F15_5 => 15.5;

  static double get F16 => 16.0;

  static double get F17 => 17.0;

  static double get F17_5 => 17.5;

  static double get F18 => 18.0;

  static double get F19 => 19.0;

  static double get F20 => 20.0;

  static double get F21 => 21.0;

  static double get F22 => 22.0;

  static double get F23 => 23.0;

  static double get F24 => 24.0;

  static double get F25 => 25.0;

  static double get F26 => 26.0;

  static double get F27 => 27.0;

  static double get F28 => 28.0;

  static double get F29 => 29.0;

  static double get F30 => 30.0;

  static double get F31 => 31.0;

  static double get F32 => 32.0;

  static double get F33 => 33.0;

  static double get F34 => 34.0;

  static double get F35 => 35.0;

  static double get F36 => 36.0;

  static double get F37 => 37.0;

  static double get F38 => 38.0;

  static double get F39 => 39.0;

  static double get F40 => 40.0;

  static double get F41 => 41.0;

  static double get F42 => 42.0;

  static double get F43 => 43.0;

  static double get F44 => 44.0;

  static double get F45 => 45.0;

  static double get F46 => 46.0;

  static double get F47 => 47.0;

  static double get F48 => 48.0;

  static double get F49 => 49.0;

  static double get F50 => 50.0;
}

extension TextStyleExt on TextStyle {
  static TextStyle textStyleDef(
      {double? fontSize,
      required Color? color,
      FontWeight? fontWeight = FontWeight.normal}) {
    fontSize ??= FUiExt.F14;
    if (fontWeight == FontWeight.w500) {
      fontWeight = FontWeight.w600;
    }
    return TextStyle(
        overflow: TextOverflow.ellipsis,
        decoration: TextDecoration.none,
        color: color,
        fontSize: fontSize,
        fontWeight: fontWeight);
  }

  static TextStyle labelStyle() => textStyleDef(
      color: Colors.black, fontSize: FUiExt.F17, fontWeight: FontWeight.w500);

  static TextStyle unselectedLabelStyle() => textStyleDef(
      color: Colors.black45, fontSize: FUiExt.F17, fontWeight: FontWeight.w500);

  static TextStyle textStyle75({double? fontSize}) {
    fontSize ??= FUiExt.F14;
    return TextStyle(
      overflow: TextOverflow.ellipsis,
      color: const Color(0XFFFB7575),
      decoration: TextDecoration.none,
      fontSize: fontSize,
    );
  }

  static TextStyle textStyle99(
      {double? fontSize, FontWeight? fontWeight = FontWeight.normal}) {
    fontSize ??= FUiExt.F14;
    return TextStyle(
      overflow: TextOverflow.ellipsis,
      color: const Color(0XFF999999),
      decoration: TextDecoration.none,
      fontSize: fontSize,
      fontWeight: fontWeight == FontWeight.w500 ? FontWeight.w600 : fontWeight,
    );
  }

  static TextStyle textStyleB868(
      {double? fontSize, FontWeight? fontWeight = FontWeight.normal}) {
    fontSize ??= FUiExt.F14;
    return TextStyle(
      overflow: TextOverflow.ellipsis,
      color: const Color(0XFF4CB868),
      decoration: TextDecoration.none,
      fontSize: fontSize,
      fontWeight: fontWeight == FontWeight.w500 ? FontWeight.w600 : fontWeight,
    );
  }

  static TextStyle textStyle33(
      {double? fontSize, FontWeight? fontWeight = FontWeight.normal}) {
    fontSize ??= FUiExt.F14;
    return TextStyle(
      overflow: TextOverflow.ellipsis,
      decoration: TextDecoration.none,
      color: const Color(0XFF333333),
      fontWeight: fontWeight == FontWeight.w500 ? FontWeight.w600 : fontWeight,
      fontSize: fontSize,
    );
  }

  static TextStyle textStyle66(
      {double? fontSize,
      overflow = TextOverflow.ellipsis,
      FontWeight? fontWeight = FontWeight.normal}) {
    fontSize ??= FUiExt.F14;
    return TextStyle(
      overflow: overflow,
      color: const Color(0XFF666666),
      decoration: TextDecoration.none,
      fontWeight: fontWeight == FontWeight.w500 ? FontWeight.w600 : fontWeight,
      fontSize: fontSize,
    );
  }

  static TextStyle textStyle_black_bold(
      {double? fontSize, fontWeight = FontWeight.w500}) {
    fontWeight = FontWeight.w600;
    fontSize ??= FUiExt.F20;
    return TextStyle(
        overflow: TextOverflow.ellipsis,
        color: Color(0xFF000000),
        fontSize: fontSize,
        decoration: TextDecoration.none,
        fontWeight: fontWeight);
  }

  static TextStyle textStyle_black_normal({double? fontSize}) {
    fontSize ??= FUiExt.F14;
    return TextStyle(
        overflow: TextOverflow.ellipsis,
        color: Colors.black,
        decoration: TextDecoration.none,
        fontSize: fontSize,
        fontWeight: FontWeight.normal);
  }

  static TextStyle textStyle_white(
      {double? fontSize, fontWeight = FontWeight.normal}) {
    fontSize ??= FUiExt.F20;
    return TextStyle(
      overflow: TextOverflow.ellipsis,
      color: Colors.white,
      decoration: TextDecoration.none,
      fontSize: fontSize,
      fontWeight: fontWeight == FontWeight.w500 ? FontWeight.w600 : fontWeight,
    );
  }

  static TextStyle textStyle_white_bold({double? fontSize}) {
    fontSize ??= FUiExt.F20;
    return TextStyle(
        overflow: TextOverflow.ellipsis,
        color: Colors.white,
        decoration: TextDecoration.none,
        fontSize: fontSize,
        fontWeight: FontWeight.w600);
  }

  static TextStyle textStyleDef2({
    double? fontSize,
    required Color? color,
    FontWeight? fontWeight = FontWeight.normal,
    String? fontFamily = '',
  }) {
    fontSize ??= FUiExt.F14;

    if (fontWeight == FontWeight.w500) {
      fontWeight = FontWeight.w600;
    }
    return TextStyle(
        overflow: TextOverflow.ellipsis,
        decoration: TextDecoration.none,
        color: color,
        fontSize: fontSize,
        fontFamily: fontFamily,
        fontWeight: fontWeight);
  }

  static BoxDecoration linearGradient37FC() {
    return BoxDecoration(
      borderRadius: BorderRadius.circular(24),
      gradient: const LinearGradient(
        begin: Alignment.centerLeft,
        end: Alignment.centerRight,
        colors: [Color(0xFF9E37FC), Color(0xFF7152F1)],
      ),
      boxShadow: [
        BoxShadow(
          color: const Color.fromRGBO(125, 0, 255, 0.5),
          offset: Offset(0, 5),
          blurRadius: 15,
        ),
      ],
    );
  }

  static BoxDecoration linearGradient1324() {
    return const BoxDecoration(
      gradient: LinearGradient(
        begin: Alignment.topCenter,
        end: Alignment.bottomCenter,
        colors: [
          Color(0xFF161324),
          Color(0xFF11111d),
        ],
      ),
    );
  }
}

extension BoxDecorationExt on BoxDecoration {
  static BoxDecoration linearGradient37FC() {
    return BoxDecoration(
      borderRadius: BorderRadius.circular(24),
      gradient: const LinearGradient(
        begin: Alignment.centerLeft,
        end: Alignment.centerRight,
        colors: [Color(0xFF9E37FC), Color(0xFF7152F1)],
      ),
      boxShadow: [
        BoxShadow(
          color: const Color.fromRGBO(125, 0, 255, 0.5),
          offset: Offset(0, 5),
          blurRadius: 15,
        ),
      ],
    );
  }

  static BoxDecoration linearGradient1324() {
    return const BoxDecoration(
      gradient: LinearGradient(
        begin: Alignment.topCenter,
        end: Alignment.bottomCenter,
        colors: [
          Color(0xFF161324),
          Color(0xFF11111d),
        ],
      ),
    );
  }
}
